#include "lolevel.h"
#include "platform.h"
#include "core.h"

static long *nrflag = (long*)0x7290; /* G11 above "aShuttersoundta" usage @FF9687A0 */

#include "../../../generic/capt_seq.c"

void __attribute__((naked,noinline)) capt_seq_task() {
 asm volatile (
                "STMFD   SP!, {R3-R9,LR}\n"
                "LDR     R6, =0x2C64\n"
                "LDR     R4, =0x38A78\n"
                "MOV     R9, #1\n"
                "MOV     R7, #0\n"
"loc_FF87B150:\n"
                "LDR     R0, [R6,#4]\n"
                "MOV     R2, #0\n"
                "MOV     R1, SP\n"
                "BL      sub_FF83894C\n"
                "TST     R0, #1\n"
                "BEQ     loc_FF87B17C\n"
                "LDR     R1, =0x5B3\n"
                "LDR     R0, =0xFF87A938\n"
                "BL      sub_FF81E88C\n"
                "BL      sub_FF81E844\n"
                "LDMFD   SP!, {R3-R9,PC}\n"
"loc_FF87B17C:\n"  
                "LDR     R0, [SP]\n"
                "LDR     R1, [R0]\n"
                "CMP     R1, #0x22\n"
                "ADDLS   PC, PC, R1,LSL#2\n"
                "B       loc_FF87B474\n"

"loc_FF87B190:\n"
                "B       loc_FF87B21C\n"

"loc_FF87B194:\n"
                "B       loc_FF87B288\n"

"loc_FF87B198:\n"
                "B       loc_FF87B2C4\n"

"loc_FF87B19C:\n"
                "B       loc_FF87B2D8\n"

"loc_FF87B1A0:\n"
                "B       loc_FF87B2D0\n"

"loc_FF87B1A4:\n"
                "B       loc_FF87B2E0\n"

"loc_FF87B1A8:\n"
                "B       loc_FF87B2E8\n"

"loc_FF87B1AC:\n"
                "B       loc_FF87B2F0\n"

"loc_FF87B1B0:\n"
                "B       loc_FF87B348\n"

"loc_FF87B1B4:\n"
                "B       loc_FF87B370\n"

"loc_FF87B1B8:\n"
                "B       loc_FF87B354\n"

"loc_FF87B1BC:\n"
                "B       loc_FF87B360\n"

"loc_FF87B1C0:\n"
                "B       loc_FF87B368\n"

"loc_FF87B1C4:\n"
                "B       loc_FF87B378\n"

"loc_FF87B1C8:\n"
                "B       loc_FF87B380\n"

"loc_FF87B1CC:\n"
                "B       loc_FF87B388\n"

"loc_FF87B1D0:\n"
               "B       loc_FF87B390\n"

"loc_FF87B1D4:\n"
                "B       loc_FF87B398\n"

"loc_FF87B1D8:\n"
                "B       loc_FF87B3A0\n"

"loc_FF87B1DC:\n"
                "B       loc_FF87B3A8\n"

"loc_FF87B1E0:\n"
                "B       loc_FF87B3B0\n"

"loc_FF87B1E4:\n"
                "B       loc_FF87B3B8\n"

"loc_FF87B1E8:\n"
                "B       loc_FF87B3C0\n"

"loc_FF87B1EC:\n"
                "B       loc_FF87B3CC\n"

"loc_FF87B1F0:\n"
                "B       loc_FF87B3D4\n"

"loc_FF87B1F4:\n"
                "B       loc_FF87B3E0\n"

"loc_FF87B1F8:\n"
                "B       loc_FF87B3E8\n"

"loc_FF87B1FC:\n"
                "B       loc_FF87B418\n"

"loc_FF87B200:\n"
                "B       loc_FF87B420\n"

"loc_FF87B204:\n"
                "B       loc_FF87B428\n"

"loc_FF87B208:\n"
                "B       loc_FF87B430\n"

"loc_FF87B20C:\n"
                "B       loc_FF87B438\n"

"loc_FF87B210:\n"
                "B       loc_FF87B440\n"

"loc_FF87B214:\n"
                "B       loc_FF87B44C\n"

"loc_FF87B218:\n"
                "B       loc_FF87B480\n"

"loc_FF87B21C:\n"
// jumptable FF87B188 entry 0            
                "BL      sub_FF87BA8C\n"
                "BL      shooting_expo_param_override\n"  // + 
                "BL      sub_FF878B18\n"

// copied over from SX10 don't know if we need it yet
//  this code added to avoid some incorrect behavior if overrides are used.
//  but it can cause some unexpected side effects. In this case, remove this code!
                 "MOV     R0, #0\n"
                 "STR     R0, [R4,#0x24]\n"  // fixes overrides  behavior at short shutter press
 //  end of my code

                "LDR     R0, [R4,#0x24]\n"
                "CMP     R0, #0\n"
                "BEQ     loc_FF87B480\n"
                "BL      sub_FF87A60C\n"
                "MOV     R5, R0\n"
                "LDR     R0, [R4,#0x24]\n"
                "CMP     R0, #0\n"
                "BEQ     loc_FF87B264\n"
                "MOV     R0, #0xC\n"
                "BL      sub_FF880488\n"
                "TST     R0, #1\n"
                "STRNE   R9, [R6,#0x10]\n"
                "LDRNE   R0, [R5,#8]\n"
                "ORRNE   R0, R0, #0x40000000\n"
                "STRNE   R0, [R5,#8]\n"
                "BNE     loc_FF87B480\n"

"loc_FF87B264:\n"
                "MOV     R0, R5\n"
                "BL      sub_FF967EF0\n"
                "MOV     R0, R5\n"
                "BL      sub_FF87A9EC\n"
                "MOV     R0, R5\n"

                //"BL      sub_FF96878C\n"	// -
                "BL      sub_FF96878C_my\n" //-------->
	"BL      capt_seq_hook_raw_here\n"      // +
                "TST     R0, #1\n"
                "STRNE   R9, [R6,#0x10]\n"
                "B       loc_FF87B480\n"

"loc_FF87B288:\n"
// jumptable entry 1 
                "LDR     R0, [R4,#0x24]\n"
                "CMP     R0, #0\n"
                "BNE     loc_FF87B2B4\n"
                "MOV     R0, #0xC\n"
                "BL      sub_FF880488\n"
                "TST     R0, #1\n"
                "LDRNE   R0, [SP]\n"
                "MOVNE   R1, #1\n"
                "LDRNE   R2, [R0,#0xC]\n"
                "MOVNE   R0, #1\n"
                "BNE     loc_FF87B340\n"

"loc_FF87B2B4:\n"
                "LDR     R0, [SP]\n"
              //"BL      sub_FF87AA64\n"  // - capt_seq_hook ist called in this subroutine
                "BL      sub_FF87AA64_my\n"
"loc_FF87B2BC:\n"
                "STR     R7, [R4,#0x24]\n"
                "B       loc_FF87B480\n"
"loc_FF87B2C4:\n"
// jumptable entry 2            
                "MOV     R0, #1\n"
                "BL      sub_FF87BD3C\n"
                "B       loc_FF87B480\n"
"loc_FF87B2D0:\n"
// jumptable entry 4
                "BL      sub_FF87B73C\n"
                "B       loc_FF87B2BC\n"
"loc_FF87B2D8:\n"
// jumptable entry 3  
                "BL      sub_FF87BA6C\n"
                "B       loc_FF87B2BC\n"
"loc_FF87B2E0:\n"
// jumptable entry 5
                "BL      sub_FF87BA74\n"
                "B       loc_FF87B480\n"
"loc_FF87B2E8:\n"
// jumptable entry 6
                "BL      sub_FF87BC2C\n"
                "B       loc_FF87B34C\n"
"loc_FF87B2F0:\n"
// jumptable entry 7
                "LDR     R5, [R0,#0xC]\n"
                "BL      sub_FF87BA7C\n"
                "MOV     R0, R5\n"
                "BL      sub_FF966F6C\n"
                "TST     R0, #1\n"
                "MOV     R8, R0\n"
                "BNE     loc_FF87B330\n"
                "BL      sub_FF88D840\n"
                "STR     R0, [R5,#0x18]\n"
                "MOV     R0, R5\n"
                "BL      sub_FF9686A4\n"
                "MOV     R0, R5\n"
                "BL      sub_FF968AA4\n"
                "MOV     R8, R0\n"
                "LDR     R0, [R5,#0x18]\n"
                "BL      sub_FF88DA54\n"
"loc_FF87B330:\n"
                "BL      sub_FF87BA6C\n"
                "MOV     R2, R5\n"
                "MOV     R1, #9\n"
                "MOV     R0, R8\n"
"loc_FF87B340:\n"
                "BL      sub_FF879044\n"
                "B       loc_FF87B480\n"
"loc_FF87B348:\n"
// jumptable entry 8 
                "BL      sub_FF87BCBC\n"
"loc_FF87B34C:\n"
                "BL      sub_FF878B18\n"
                "B       loc_FF87B480\n"
"loc_FF87B354:\n"
// jumptable entry 10
                "LDR     R0, [R4,#0x54]\n"
                "BL      sub_FF87C340\n"
                "B       loc_FF87B480\n"
"loc_FF87B360:\n"
// jumptable entry 11
                "BL      sub_FF87C5E8\n"
                "B       loc_FF87B480\n"
"loc_FF87B368:\n"
// jumptable entry 12
                "BL      sub_FF87C67C\n"
                "B       loc_FF87B480\n"
"loc_FF87B370:\n"
// jumptable entry 9
                "BL      sub_FF87BA6C\n"
                "B       loc_FF87B480\n"
"loc_FF87B378:\n"
// jumptable entry 13
                "BL      sub_FF967198\n"
                "B       loc_FF87B480\n"
"loc_FF87B380:\n"
// jumptable entry 14
                "BL      sub_FF9673F0\n"
                "B       loc_FF87B480\n"
"loc_FF87B388:\n"
// jumptable entry 15
                "BL      sub_FF967490\n"
                "B       loc_FF87B480\n"
"loc_FF87B390:\n"
// jumptable entry 16
                "BL      sub_FF9675C4\n"
                "B       loc_FF87B480\n"
"loc_FF87B398:\n"
// jumptable entry 17
                "BL      sub_FF9676B8\n"
                "B       loc_FF87B480\n"
"loc_FF87B3A0:\n"
// jumptable entry 18
                "MOV     R0, #0\n"
                "B       loc_FF87B3C4\n"
"loc_FF87B3A8:\n"
// jumptable entry 19
                "BL      sub_FF967C34\n"
                "B       loc_FF87B480\n"
"loc_FF87B3B0:\n"
// jumptable entry 20
                "BL      sub_FF967CC4\n"
                "B       loc_FF87B480\n"
"loc_FF87B3B8:\n"
// jumptable entry 21 
                "BL      sub_FF967D84\n"
                "B       loc_FF87B480\n"
"loc_FF87B3C0:\n"
// jumptable entry 22
                "MOV     R0, #1\n"
"loc_FF87B3C4:\n"
                "BL      sub_FF967AE4\n"
                "B       loc_FF87B480\n"
"loc_FF87B3CC:\n"
// jumptable entry 23
                "BL      sub_FF87BF58\n"
                "B       loc_FF87B480\n"
"loc_FF87B3D4:\n"
// jumptable entry 24
                "BL      sub_FF87BFF8\n"
                "BL      sub_FF87B5A8\n"
                "B       loc_FF87B480\n"
"loc_FF87B3E0:\n"
// jumptable entry 25
                "BL      sub_FF967970\n"
                "B       loc_FF87B480\n"
"loc_FF87B3E8:\n"
// jumptable entry 26 
                "MOV     R2, #2\n"
                "ADD     R1, R4, #0x62\n"
                "MOV     R0, #0x6F\n"
                "BL      sub_FF88D6B0\n" //PT_GetPropertyCaseString_0
                "TST     R0, #1\n"
                "LDRNE   R1, =0x6AA\n"
//                "ADRNE   R0, 0xFF87A938\n" // "SsShootTask.c"
                "LDRNE   R0,=0xFF87A938\n" // "SsShootTask.c"
                "BLNE    sub_FF81E88C\n"
                "LDRH    R0, [R4,#0x62]\n"
                "CMP     R0, #1\n"
                "BLEQ    sub_FF967964\n"
                "B       loc_FF87B480\n"
"loc_FF87B418:\n"
// jumptable entry 27
                "BL      sub_FF967A14\n"
                "B       loc_FF87B480\n"
"loc_FF87B420:\n"
// jumptable entry 28
                "BL      sub_FF87A8C4\n"
                "B       loc_FF87B480\n"
"loc_FF87B428:\n"
// jumptable entry 29
                "BL      sub_FF83657C\n"
                "B       loc_FF87B480\n"
"loc_FF87B430:\n"
// jumptable entry 30
                "BL      sub_FF87EA34\n"
                "B       loc_FF87B480\n"
"loc_FF87B438:\n"
// jumptable entry 31
                "BL      sub_FF87EA9C\n"
                "B       loc_FF87B480\n"
"loc_FF87B440:\n"
// jumptable entry 32
                "BL      sub_FF87EAF8\n"
                "BL      sub_FF87EAB8\n"
                "B       loc_FF87B480\n"
"loc_FF87B44C:\n"
// jumptable entry 33
                "MOV     R0, #1\n"
                "BL      sub_FF96930C\n"
                "MOV     R0, #1\n"
                "BL      sub_FF96941C\n"
                "LDRH    R0, [R4,#0xA0]\n"
                "CMP     R0, #4\n"
                "BNE     loc_FF87B480\n"
                "BL      sub_FF87EA9C\n"
                "BL      sub_FF87EEE4\n"
                "B       loc_FF87B480\n"
"loc_FF87B474:\n"
// jumptable default entry
                "LDR     R1, =0x708\n"
                "LDR     R0, =0xFF87A938\n"
                "BL      sub_FF81E88C\n"
"loc_FF87B480:\n"
//; jumptable FF87"B188 entry 34           ; Load from Memory
                "LDR     R0, [SP]\n"
                "LDR     R1, [R0,#4]\n"
                "LDR     R0, [R6]\n"
                "BL      sub_FF8854E8\n"
                "LDR     R5, [SP]\n"
                "LDR     R0, [R5,#8]\n"
                "CMP     R0, #0\n"
                "LDREQ   R1, =0x131\n"
//                "ADREQ   R0, aSsshoottask_c\n"
                "LDREQ   R0, =0xFF87A938\n" // "SsShootTask.c"
                "BLEQ    sub_FF81E88C\n"
                "STR     R7, [R5,#8]\n"
                "B       loc_FF87B150\n"
 );
}
void __attribute__((naked,noinline)) sub_FF87AA64_my() {
 asm volatile (
                "STMFD   SP!, {R3-R9,LR}\n"
                "LDR     R4, [R0,#0xC]\n"
                "LDR     R5, =0x38A78\n"
                "LDR     R0, [R4,#8]\n"
                "LDR     R6, =0x420A\n"
                "ORR     R0, R0, #1\n"
                "STR     R0, [R4,#8]\n"
                "LDRH    R0, [R5]\n"
                "LDR     R8, =0x2C64\n"
                "MOV     R7, #0\n"
                "CMP     R0, R6\n"
                "BEQ     loc_FF87AB08\n"
                "LDRH    R0, [R5,#0x9E]\n"
                "CMP     R0, #3\n"
                "BEQ     loc_FF87AB68\n"
                "LDR     R0, [R4,#0xC]\n"
                "CMP     R0, #1\n"
                "BLS     loc_FF87AB14\n"
                "LDRH    R0, [R5,#0x9C]\n"
                "CMP     R0, #0\n"
                "BNE     loc_FF87AB68\n"
                "LDRH    R0, [R5,#0x98]\n"
                "CMP     R0, #2\n"
                "BNE     loc_FF87AB20\n"
                "BL      sub_FF87C0A8\n"
                "LDRH    R0, [R5]\n"
                "CMP     R0, R6\n"
                "BEQ     loc_FF87AB08\n"
                "LDRH    R0, [R5,#0x9E]\n"
                "CMP     R0, #3\n"
                "BEQ     loc_FF87AB68\n"
                "LDR     R0, [R4,#0xC]\n"
                "CMP     R0, #1\n"
                "BLS     loc_FF87AB14\n"
                "LDRH    R0, [R5,#0x9C]\n"
                "CMP     R0, #0\n"
                "BNE     loc_FF87AB68\n"
                "LDRH    R0, [R5,#0x98]\n"
                "CMP     R0, #2\n"
                "BEQ     loc_FF87AB4C\n"
                "B       loc_FF87AB20\n"
"loc_FF87AB08:\n"
                "LDRH    R0, [R5,#0x9E]\n"
                "CMP     R0, #3\n"
                "BEQ     loc_FF87AB68\n"
"loc_FF87AB14:\n"
                "LDRH    R0, [R5,#0x9C]\n"
                "CMP     R0, #0\n"
                "BNE     loc_FF87AB68\n"
"loc_FF87AB20:\n"
                "LDRH    R0, [R5,#0x98]\n"
                "CMP     R0, #1\n"
                "BNE     loc_FF87AB68\n"
                "LDRH    R0, [R5]\n"
                "CMP     R0, R6\n"
                "LDRNE   R0, [R4,#0xC]\n"
                "CMPNE   R0, #1\n"
                "BLS     loc_FF87AB68\n"
                "LDR     R0, [R4,#0x10]\n"
                "CMP     R0, #1\n"
                "BNE     loc_FF87AB68\n"
"loc_FF87AB4C:\n"
                "MOV     R3, #0x268\n"
                "STR     R3, [SP]\n"
                "LDR     R0, [R8]\n"
                "LDR     R2, =0xEA60\n"
                "LDR     R3, =0xFF87A938\n"// ; "SsShootTask.c"
                "MOV     R1, #0x40000000\n"
                "BL      sub_FF8807F0\n"
"loc_FF87AB68:\n"
                "BL      sub_FF87A8C4\n"
                "LDR     R0, [R5,#0x24]\n"
                "CMP     R0, #0\n"
                "MOVEQ   R0, #2\n"
                "BLEQ    sub_FF876CA8\n"
                "BL      sub_FF87BA7C\n"
                "LDR     R0, [R5,#0x24]\n"
                "CMP     R0, #0\n"
                "BNE     loc_FF87AC20\n"
                "MOV     R0, #0\n"
                "BL      sub_FF96930C\n"
                "MOV     R0, #0\n"
                "BL      sub_FF96941C\n"
                "MOV     R0, R4\n"
                "BL      sub_FF967EF0\n"
                "MOV     R0, R4\n"
                "BL      sub_FF87BED4\n"
                "MOV     R0, R4\n"
                "BL      sub_FF966B20\n"
                "CMP     R0, #0\n"
                "BEQ     loc_FF87ABE8\n"
                "BL      sub_FF96934C\n"
                "BL      sub_FF969460\n"
                "BL      sub_FF9694B0\n"
                "MOV     R0, R4\n"
                "BL      sub_FF966C98\n"
                "TST     R0, #1\n"
                "MOVNE   R2, R4\n"
                "LDMNEFD SP!, {R3-R9,LR}\n"
                "MOVNE   R1, #1\n"
                "BNE     sub_FF879044\n"
                "B       loc_FF87ABFC\n"
"loc_FF87ABE8:\n"
                "MOV     R0, R4\n"
                "BL      sub_FF966C04\n"
                "BL      sub_FF96934C\n"
                "BL      sub_FF969460\n"
                "BL      sub_FF9694B0\n"
"loc_FF87ABFC:\n"
                "MOV     R0, R4\n"
                "BL      sub_FF87A9EC\n"
                "MOV     R0, R4\n"
                "BL      sub_FF9686A4\n"
                "BL      sub_FF969124\n"
                "MOV     R0, R4\n"
              //"BL      sub_FF96878C\n"// -
                "BL      sub_FF96878C_my\n"//-------->
                "MOV     R7, R0\n"
                "BL      capt_seq_hook_raw_here\n"      // +
                "B       loc_FF87AC2C\n"
"loc_FF87AC20:\n"
                "LDR     R0, [R8,#0x10]\n"
                "CMP     R0, #0\n"
                "MOVNE   R7, #0x1D\n"
"loc_FF87AC2C:\n"
                "BL      sub_FF87EA9C\n"
                "BL      sub_FF87EAE4\n"
                "BL      sub_FF87EB24\n"
                "MOV     R2, R4\n"
                "MOV     R1, #1\n"
                "MOV     R0, R7\n"
                "BL      sub_FF879044\n"
                "BL      sub_FF968A48\n"
                "CMP     R0, #0\n"
                "LDRNE   R0, [R4,#8]\n"
                "ORRNE   R0, R0, #0x2000\n"
                "STRNE   R0, [R4,#8]\n"
                "LDRH    R0, [R5,#0x9E]\n"
                "CMP     R0, #3\n"
                "BEQ     locret_FF87AC84\n"
                "LDRH    R0, [R5,#0x9C]\n"
                "CMP     R0, #0\n"
                "LDREQH  R0, [R5,#0x98]\n"
                "CMPEQ   R0, #2\n"
                "MOVEQ   R0, R4\n"
                "LDMEQFD SP!, {R3-R9,LR}\n"
                "BEQ     sub_FF87C0FC\n"
"locret_FF87AC84:\n"
                "LDMFD   SP!, {R3-R9,PC}\n"
 );
}

void __attribute__((naked,noinline)) sub_FF96878C_my() {
 asm volatile (
               "STMFD   SP!, {R0-R8,LR}\n"
               "MOV     R4, R0\n"
               "BL      sub_FF969608\n"
//               "MOVL    R1, 0xFFFFFFFF\n"
               "LDR    R1,=0xFFFFFFFF\n"
               "BL      sub_FF88551C\n"
               "LDR     R5, =0x7290\n"
               "LDR     R0, [R5,#0xC]\n"
               "CMP     R0, #0\n"
               "BNE     loc_FF9687DC\n"
               "MOV     R1, #1\n"
               "MOV     R0, #0\n"
               "BL      sub_FF839194\n"
               "STR     R0, [R5,#0xC]\n"
               "MOV     R3, #0\n"
               "STR     R3, [SP]\n"
               "LDR     R3, =0xFF968118\n"
               "LDR     R0, =0xFF968A0C\n" // "ShutterSoundTask"
               "MOV     R2, #0x400\n"
               "MOV     R1, #0x17\n"
               "BL      sub_FF839160\n"
"loc_FF9687DC:\n"
               "MOV     R2, #4\n"
               "ADD     R1, SP, #0x8\n"
               "MOV     R0, #0x8A\n"
               "BL      sub_FF88D6B0\n" //PT_GetPropertyCaseString_0
               "TST     R0, #1\n"
               "LDRNE   R1, =0x3C5\n"
               "LDRNE   R0, =0xFF88D594\n" // aSscaptureseq_c
               "BLNE    sub_FF81E88C\n" //DebugAssert
               "LDR     R6, =0x38B44\n"
               "LDR     R8, =0x38A78\n"
               "LDR     R3, [R6]\n"
               "LDRSH   R2, [R6,#0xC]\n"
               "LDRSH   R1, [R6,#0xE]\n"
               "LDR     R0, [R8,#0x94]\n"
               "BL      sub_FF92FC30\n"
               "BL      sub_FF863564\n"
               "LDR     R3, =0x7298\n"
               "STRH    R0, [R4,#0xA4]\n"
               "SUB     R2, R3, #4\n"
               "STRD    R2, [SP]\n"
               "MOV     R1, R0\n"
               "LDRH    R0, [R8,#0x5C]\n"
               "LDRSH   R2, [R6,#0xC]\n"
               "SUB     R3, R3, #8\n"
               "BL      sub_FF96B290\n" 
               "BL      wait_until_remote_button_is_released\n"  // +
               "BL      capt_seq_hook_set_nr\n"                  // +   
               "B       sub_FF968840\n" // +  Jump back to original FW code
 );
}

void __attribute__((naked,noinline)) exp_drv_task(){
 asm volatile(
               "STMFD   SP!, {R4-R8,LR}\n"
               "SUB     SP, SP, #0x20\n"
               "LDR     R8, =0xBB8\n"
               "LDR     R7, =0x4530\n"
               "LDR     R5, =0x42240\n"
               "MOV     R0, #0\n"
               "ADD     R6, SP, #0x10\n"
               "STR     R0, [SP,#0xC]\n"
"loc_FF8BFBC8:\n"
               "LDR     R0, [R7,#0x20]\n"
               "MOV     R2, #0\n"
               "ADD     R1, SP, #0x1C\n"
               "BL      sub_FF83894C\n"
               "LDR     R0, [SP,#0xC]\n"
               "CMP     R0, #1\n"
               "BNE     loc_FF8BFC14\n"
               "LDR     R0, [SP,#0x1C]\n"
               "LDR     R0, [R0]\n"
               "CMP     R0, #0x13\n"
               "CMPNE   R0, #0x14\n"
               "CMPNE   R0, #0x15\n"
               "CMPNE   R0, #0x16\n"
               "BEQ     loc_FF8BFD78\n"
               "CMP     R0, #0x28\n"
               "BEQ     loc_FF8BFD00\n"
               "ADD     R1, SP, #0xC\n"
               "MOV     R0, #0\n"
               "BL      sub_FF8BFB58\n"
"loc_FF8BFC14:\n"
               "LDR     R0, [SP,#0x1C]\n"
               "LDR     R1, [R0]\n"
               "CMP     R1, #0x2E\n"
               "BNE     loc_FF8BFC44\n"
               "LDR     R0, [SP,#0x1C]\n"
               "BL      sub_FF8C0EAC\n"
               "LDR     R0, [R7,#0x1C]\n"
               "MOV     R1, #1\n"
               "BL      sub_FF8854E8\n"
               "BL      sub_FF81E844\n" // eventproc_export_ExitTask
               "ADD     SP, SP, #0x20\n"
               "LDMFD   SP!, {R4-R8,PC}\n"
"loc_FF8BFC44:\n"
               "CMP     R1, #0x2D\n"
               "BNE     loc_FF8BFC60\n"
               "LDR     R2, [R0,#0x8C]!\n"
               "LDR     R1, [R0,#4]\n"
               "MOV     R0, R1\n"
               "BLX     R2\n"
               "B       loc_FF8C01A0\n"
"loc_FF8BFC60:\n"
               "CMP     R1, #0x26\n"
               "BNE     loc_FF8BFCB0\n"
               "LDR     R0, [R7,#0x1C]\n"
               "MOV     R1, #0x80\n"
               "BL      sub_FF88551C\n"
               "LDR     R0, =0xFF8BC2E8\n"
               "MOV     R1, #0x80\n"
               "BL      sub_FF95B400\n" //__IrisController.c__98
               "LDR     R0, [R7,#0x1C]\n"
               "MOV     R2, R8\n"
               "MOV     R1, #0x80\n"
               "BL      sub_FF885428\n" //__KerFlag.c__0
               "TST     R0, #1\n"
               "LDRNE   R1, =0xE5F\n"
               "BNE     loc_FF8BFD6C\n"
"loc_FF8BFC9C:\n"
               "LDR     R1, [SP,#0x1C]\n"
               "LDR     R0, [R1,#0x90]\n"
               "LDR     R1, [R1,#0x8C]\n"
               "BLX     R1\n"
               "B       loc_FF8C01A0\n"
"loc_FF8BFCB0:\n"
               "CMP     R1, #0x27\n"
               "BNE     loc_FF8BFCF8\n"
               "ADD     R1, SP, #0xC\n"
               "BL      sub_FF8BFB58\n" //__ExpDrv.c__512
               "LDR     R0, [R7,#0x1C]\n"
               "MOV     R1, #0x100\n"
               "BL      sub_FF88551C\n"
               "LDR     R0, =0xFF8BC2F8\n"
               "MOV     R1, #0x100\n"
               "BL      sub_FF95BD90\n" //__IrisController.c__384
               "LDR     R0, [R7,#0x1C]\n"
               "MOV     R2, R8\n"
               "MOV     R1, #0x100\n"
               "BL      sub_FF885428\n" //__KerFlag.c__0
               "TST     R0, #1\n"
               "BEQ     loc_FF8BFC9C\n"
               "LDR     R1, =0xE69\n"
               "B       loc_FF8BFD6C\n"
"loc_FF8BFCF8:\n"
               "CMP     R1, #0x28\n"
               "BNE     loc_FF8BFD10\n"
"loc_FF8BFD00:\n"
               "LDR     R0, [SP,#0x1C]\n"
               "ADD     R1, SP, #0xC\n"
               "BL      sub_FF8BFB58\n"
               "B       loc_FF8BFC9C\n"
"loc_FF8BFD10:\n"
               "CMP     R1, #0x2B\n"
               "BNE     loc_FF8BFD28\n"
               "BL      sub_FF8AF74C\n" //__Shutter.c__2
               "BL      sub_FF8B0370\n" //__ImgPixel.c__272
               "BL      sub_FF8AFEC4\n" //__ImgGain.c__0
               "B       loc_FF8BFC9C\n"
"loc_FF8BFD28:\n"
               "CMP     R1, #0x2C\n"
               "BNE     loc_FF8BFD78\n"
               "LDR     R0, [R7,#0x1C]\n"
               "MOV     R1, #4\n"
               "BL      sub_FF88551C\n"
               "LDR     R1, =0xFF8BC318\n"
               "LDR     R0, =0xFFFFF400\n"
               "MOV     R2, #4\n"
               "BL      sub_FF8AF1C8\n"
               "BL      sub_FF8AF450\n" //__Shutter.c__0
               "LDR     R0, [R7,#0x1C]\n"
               "MOV     R2, R8\n"
               "MOV     R1, #4\n"
               "BL      sub_FF885344\n" //__KerFlag.c__0
               "TST     R0, #1\n"
               "BEQ     loc_FF8BFC9C\n"
               "LDR     R1, =0xE91\n"
"loc_FF8BFD6C:\n"
               "LDR     R0, =0xFF8BC958\n" // aExpdrv_c
               "BL      sub_FF81E88C\n" // DebugAssert
               "B       loc_FF8BFC9C\n"
"loc_FF8BFD78:\n"
               "LDR     R0, [SP,#0x1C]\n"
               "MOV     R4, #1\n"
               "LDR     R1, [R0]\n"
               "CMP     R1, #0x11\n"
               "CMPNE   R1, #0x12\n"
               "BNE     loc_FF8BFDE8\n"
               "LDR     R1, [R0,#0x7C]\n"
               "ADD     R1, R1, R1,LSL#1\n"
               "ADD     R1, R0, R1,LSL#2\n"
               "SUB     R1, R1, #8\n"
               "LDMIA   R1, {R2-R4}\n"
               "STMIA   R6, {R2-R4}\n"
//               "BL      loc_FF8BE4D0\n"
               "BL      sub_FF8BE4D0\n"
               "LDR     R0, [SP,#0x1C]\n"
               "LDR     R1, [R0,#0x7C]\n"
               "LDR     R3, [R0,#0x8C]\n"
               "LDR     R2, [R0,#0x90]\n"
               "ADD     R0, R0, #4\n"
               "BLX     R3\n"
               "LDR     R0, [SP,#0x1C]\n"
               "BL      sub_FF8C1274\n"
               "LDR     R0, [SP,#0x1C]\n"
               "LDR     R1, [R0,#0x7C]\n"
               "LDR     R3, [R0,#0x94]\n"
               "LDR     R2, [R0,#0x98]\n"
               "ADD     R0, R0, #4\n"
               "BLX     R3\n"
               "B       loc_FF8C00E0\n"
"loc_FF8BFDE8:\n"
               "CMP     R1, #0x13\n"
               "CMPNE   R1, #0x14\n"
               "CMPNE   R1, #0x15\n"
               "CMPNE   R1, #0x16\n"
               "BNE     loc_FF8BFEA0\n"
               "ADD     R3, SP, #0xC\n"
               "MOV     R2, SP\n"
               "ADD     R1, SP, #0x10\n"
               "BL      sub_FF8BE7AC\n"
               "CMP     R0, #1\n"
               "MOV     R4, R0\n"
               "CMPNE   R4, #5\n"
               "BNE     loc_FF8BFE3C\n"
               "LDR     R0, [SP,#0x1C]\n"
               "MOV     R2, R4\n"
               "LDR     R1, [R0,#0x7C]!\n"
               "LDR     R12, [R0,#0x10]!\n"
               "LDR     R3, [R0,#4]\n"
               "MOV     R0, SP\n"
               "BLX     R12\n"
               "B       loc_FF8BFE74\n"
"loc_FF8BFE3C:\n"
               "LDR     R0, [SP,#0x1C]\n"
               "CMP     R4, #2\n"
               "LDR     R3, [R0,#0x90]\n"
               "CMPNE   R4, #6\n"
               "BNE     loc_FF8BFE88\n"
               "LDR     R12, [R0,#0x8C]\n"
               "MOV     R0, SP\n"
               "MOV     R2, R4\n"
               "MOV     R1, #1\n"
               "BLX     R12\n"
               "LDR     R0, [SP,#0x1C]\n"
               "MOV     R2, SP\n"
               "ADD     R1, SP, #0x10\n"
               "BL      sub_FF8BF864\n"
"loc_FF8BFE74:\n"
               "LDR     R0, [SP,#0x1C]\n"
               "LDR     R2, [SP,#0xC]\n"
               "MOV     R1, R4\n"
               "BL      sub_FF8BFAF8\n"
               "B       loc_FF8C00E0\n"
"loc_FF8BFE88:\n"
               "LDR     R1, [R0,#0x7C]\n"
               "LDR     R12, [R0,#0x8C]\n"
               "ADD     R0, R0, #4\n"
               "MOV     R2, R4\n"
               "BLX     R12\n"
               "B       loc_FF8C00E0\n"
"loc_FF8BFEA0:\n"
               "CMP     R1, #0x22\n"
               "CMPNE   R1, #0x23\n"
               "BNE     loc_FF8BFEEC\n"
               "LDR     R1, [R0,#0x7C]\n"
               "ADD     R1, R1, R1,LSL#1\n"
               "ADD     R1, R0, R1,LSL#2\n"
               "SUB     R1, R1, #8\n"
               "LDMIA   R1, {R2-R4}\n"
               "STMIA   R6, {R2-R4}\n"
               "BL      sub_FF8BDA14\n"
               "LDR     R0, [SP,#0x1C]\n"
               "LDR     R1, [R0,#0x7C]\n"
               "LDR     R3, [R0,#0x8C]\n"
               "LDR     R2, [R0,#0x90]\n"
               "ADD     R0, R0, #4\n"
               "BLX     R3\n"
               "LDR     R0, [SP,#0x1C]\n"
               "BL      sub_FF8BDD14\n"
               "B       loc_FF8C00E0\n"
"loc_FF8BFEEC:\n"
               "ADD     R1, R0, #4\n"
               "LDMIA   R1, {R2,R3,R12}\n"
               "STMIA   R6, {R2,R3,R12}\n"
               "LDR     R1, [R0]\n"
               "CMP     R1, #0x25\n"
               "ADDLS   PC, PC, R1,LSL#2\n"
               "B       loc_FF8C00C0\n"
"loc_FF8BFF08:\n"
               "B       loc_FF8BFFA0\n"
"loc_FF8BFF0C:\n"
               "B       loc_FF8BFFA0\n"
"loc_FF8BFF10:\n"
               "B       loc_FF8BFFA8\n"
"loc_FF8BFF14:\n"
               "B       loc_FF8BFFB0\n"
"loc_FF8BFF18:\n"
               "B       loc_FF8BFFB0\n"
"loc_FF8BFF1C:\n"
               "B       loc_FF8BFFB0\n"
"loc_FF8BFF20:\n"
               "B       loc_FF8BFFA0\n"
"loc_FF8BFF24:\n"
               "B       loc_FF8BFFA8\n"
"loc_FF8BFF28:\n"
               "B       loc_FF8BFFB0\n"
"loc_FF8BFF2C:\n"
               "B       loc_FF8BFFB0\n"
"loc_FF8BFF30:\n"
               "B       loc_FF8BFFC8\n"
"loc_FF8BFF34:\n"
               "B       loc_FF8BFFC8\n"
"loc_FF8BFF38:\n"
               "B       loc_FF8C00B4\n"
"loc_FF8BFF3C:\n"
               "B       loc_FF8C00BC\n"
"loc_FF8BFF40:\n"
               "B       loc_FF8C00BC\n"
"loc_FF8BFF44:\n"
               "B       loc_FF8C00BC\n"
"loc_FF8BFF48:\n"
               "B       loc_FF8C00BC\n"
"loc_FF8BFF4C:\n"
               "B       loc_FF8C00C0\n"
"loc_FF8BFF50:\n"
               "B       loc_FF8C00C0\n"
"loc_FF8BFF54:\n"
               "B       loc_FF8C00C0\n"
"loc_FF8BFF58:\n"
               "B       loc_FF8C00C0\n"
"loc_FF8BFF5C:\n"
               "B       loc_FF8C00C0\n"
"loc_FF8BFF60:\n"
               "B       loc_FF8C00C0\n"
"loc_FF8BFF64:\n"
               "B       loc_FF8BFFB8\n"
"loc_FF8BFF68:\n"
               "B       loc_FF8BFFC0\n"
"loc_FF8BFF6C:\n"
               "B       loc_FF8BFFC0\n"
"loc_FF8BFF70:\n"
               "B       loc_FF8BFFD4\n"
"loc_FF8BFF74:\n"
               "B       loc_FF8BFFD4\n"
"loc_FF8BFF78:\n"
               "B       loc_FF8BFFDC\n"
"loc_FF8BFF7C:\n"
               "B       loc_FF8C000C\n"
"loc_FF8BFF80:\n"
               "B       loc_FF8C003C\n"
"loc_FF8BFF84:\n"
               "B       loc_FF8C006C\n"
"loc_FF8BFF88:\n"
               "B       loc_FF8C009C\n"
"loc_FF8BFF8C:\n"
               "B       loc_FF8C009C\n"
"loc_FF8BFF90:\n"
               "B       loc_FF8C00C0\n"
"loc_FF8BFF94:\n"
               "B       loc_FF8C00C0\n"
"loc_FF8BFF98:\n"
               "B       loc_FF8C00A4\n"
"loc_FF8BFF9C:\n"
               "B       loc_FF8C00AC\n"
"loc_FF8BFFA0:\n"
//; jumptable FF8"FF00 entries 0,1,6
               "BL      sub_FF8BC800\n"
               "B       loc_FF8C00C0\n"
"loc_FF8BFFA8:\n"
//; jumptable FF8"FF00 entries 2,7
               "BL      sub_FF8BCA84\n"
               "B       loc_FF8C00C0\n"
"loc_FF8BFFB0:\n"
//; jumptable FF8"FF00 entries 3-5,8,9
               "BL      sub_FF8BCC8C\n"
               "B       loc_FF8C00C0\n"
"loc_FF8BFFB8:\n"
//; jumptable FF8"FF00 entry 23
               "BL      sub_FF8BCF04\n"
               "B       loc_FF8C00C0\n"
"loc_FF8BFFC0:\n"
//; jumptable FF8"FF00 entries 24,25
               "BL      sub_FF8BD0FC\n"
               "B       loc_FF8C00C0\n"
"loc_FF8BFFC8:\n"
//; jumptable FF8"FF00 entries 10,11
             //"BL      sub_FF8BD3B8\n"    // -
               "BL      sub_FF8BD3B8_my\n" //----------------------->
               "MOV     R4, #0\n"
               "B       loc_FF8C00C0\n"
"loc_FF8BFFD4:\n"
//; jumptable FF8"FF00 entries 26,27
               "BL      sub_FF8BD4F8\n"
               "B       loc_FF8C00C0\n"
"loc_FF8BFFDC:\n"
//; jumptable FF8"FF00 entry 28
               "LDRH    R1, [R0,#4]\n"
               "STRH    R1, [SP,#0x10]\n"
               "LDRH    R1, [R5,#2]\n"
               "STRH    R1, [SP,#0x12]\n"
               "LDRH    R1, [R5,#4]\n"
               "STRH    R1, [SP,#0x14]\n"
               "LDRH    R1, [R5,#6]\n"
               "STRH    R1, [SP,#0x16]\n"
               "LDRH    R1, [R0,#0xC]\n"
               "STRH    R1, [SP,#0x18]\n"
               "BL      sub_FF8C0F20\n"
               "B       loc_FF8C00C0\n"
"loc_FF8C000C:\n"
//; jumptable FF8"FF00 entry 29
               "LDRH    R1, [R0,#4]\n"
               "STRH    R1, [SP,#0x10]\n"
               "LDRH    R1, [R5,#2]\n"
               "STRH    R1, [SP,#0x12]\n"
               "LDRH    R1, [R5,#4]\n"
               "STRH    R1, [SP,#0x14]\n"
               "LDRH    R1, [R5,#6]\n"
               "STRH    R1, [SP,#0x16]\n"
               "LDRH    R1, [R5,#8]\n"
               "STRH    R1, [SP,#0x18]\n"
               "BL      sub_FF8C108C\n"
               "B       loc_FF8C00C0\n"
"loc_FF8C003C:\n"
//; jumptable FF8"FF00 entry 30
               "LDRH    R1, [R5]\n"
               "STRH    R1, [SP,#0x10]\n"
               "LDRH    R1, [R0,#6]\n"
               "STRH    R1, [SP,#0x12]\n"
               "LDRH    R1, [R5,#4]\n"
               "STRH    R1, [SP,#0x14]\n"
               "LDRH    R1, [R5,#6]\n"
               "STRH    R1, [SP,#0x16]\n"
               "LDRH    R1, [R5,#8]\n"
               "STRH    R1, [SP,#0x18]\n"
               "BL      sub_FF8C1138\n"
               "B       loc_FF8C00C0\n"
"loc_FF8C006C:\n"
//; jumptable FF8"FF00 entry 31
               "LDRH    R1, [R5]\n"
               "STRH    R1, [SP,#0x10]\n"
               "LDRH    R1, [R5,#2]\n"
               "STRH    R1, [SP,#0x12]\n"
               "LDRH    R1, [R5,#4]\n"
               "STRH    R1, [SP,#0x14]\n"
               "LDRH    R1, [R5,#6]\n"
               "STRH    R1, [SP,#0x16]\n"
               "LDRH    R1, [R0,#0xC]\n"
               "STRH    R1, [SP,#0x18]\n"
               "BL      sub_FF8C11D8\n"
               "B       loc_FF8C00C0\n"
"loc_FF8C009C:\n"
//; jumptable FF8"FF00 entries 32,33
               "BL      sub_FF8BD850\n"
               "B       loc_FF8C00C0\n"
"loc_FF8C00A4:\n"
//; jumptable FF8"FF00 entry 36
               "BL      sub_FF8BDE18\n"
               "B       loc_FF8C00C0\n"
"loc_FF8C00AC:\n"
//; jumptable FF8"FF00 entry 37
               "BL      sub_FF8BE054\n"
               "B       loc_FF8C00C0\n"
"loc_FF8C00B4:\n"
//; jumptable FF8"FF00 entry 12
               "BL      sub_FF8BE1D0\n"
               "B       loc_FF8C00C0\n"
"loc_FF8C00BC:\n"
//; jumptable FF8"FF00 entries 13-16
               "BL      sub_FF8BE36C\n"
"loc_FF8C00C0:\n"
//; jumptable FF8"FF00 default entry
//; jumptable FF8"FF00 entries 17-22,34,35
               "LDR     R0, [SP,#0x1C]\n"
               "LDR     R1, [R0,#0x7C]\n"
               "LDR     R3, [R0,#0x8C]\n"
               "LDR     R2, [R0,#0x90]\n"
               "ADD     R0, R0, #4\n"
               "BLX     R3\n"
               "CMP     R4, #1\n"
               "BNE     loc_FF8C0128\n"
"loc_FF8C00E0:\n"
               "LDR     R0, [SP,#0x1C]\n"
               "MOV     R2, #0xC\n"
               "LDR     R1, [R0,#0x7C]\n"
               "ADD     R1, R1, R1,LSL#1\n"
               "ADD     R0, R0, R1,LSL#2\n"
               "SUB     R4, R0, #8\n"
               "LDR     R0, =0x42240\n"
               "ADD     R1, SP, #0x10\n"
               "BL      sub_FFB3C824\n"
               "LDR     R0, =0x4224C\n"
               "MOV     R2, #0xC\n"
               "ADD     R1, SP, #0x10\n"
               "BL      sub_FFB3C824\n"
               "LDR     R0, =0x42258\n"
               "MOV     R2, #0xC\n"
               "MOV     R1, R4\n"
               "BL      sub_FFB3C824\n"
               "B       loc_FF8C01A0\n"
"loc_FF8C0128:\n"
               "LDR     R0, [SP,#0x1C]\n"
               "LDR     R0, [R0]\n"
               "CMP     R0, #0xB\n"
               "BNE     loc_FF8C0170\n"
               "MOV     R3, #0\n"
               "STR     R3, [SP]\n"
               "MOV     R3, #1\n"
               "MOV     R2, #1\n"
               "MOV     R1, #1\n"
               "MOV     R0, #0\n"
               "BL      sub_FF8BC608\n"
               "MOV     R3, #0\n"
               "STR     R3, [SP]\n"
               "MOV     R3, #1\n"
               "MOV     R2, #1\n"
               "MOV     R1, #1\n"
               "MOV     R0, #0\n"
               "B       loc_FF8C019C\n"
"loc_FF8C0170:\n"
               "MOV     R3, #1\n"
               "MOV     R2, #1\n"
               "MOV     R1, #1\n"
               "MOV     R0, #1\n"
               "STR     R3, [SP]\n"
               "BL      sub_FF8BC608\n"
               "MOV     R3, #1\n"
               "MOV     R2, #1\n"
               "MOV     R1, #1\n"
               "MOV     R0, #1\n"
               "STR     R3, [SP]\n"
"loc_FF8C019C:\n"
               "BL      sub_FF8BC748\n"
"loc_FF8C01A0:\n"
               "LDR     R0, [SP,#0x1C]\n"
               "BL      sub_FF8C0EAC\n"
               "B       loc_FF8BFBC8\n"
);
};
void __attribute__((naked,noinline)) sub_FF8BD3B8_my(){ // 
 asm volatile(
               "STMFD   SP!, {R4-R8,LR}\n"
               "LDR     R7, =0x4530\n"
               "MOV     R4, R0\n"
               "LDR     R0, [R7,#0x1C]\n"
               "MOV     R1, #0x3E\n"
               "BL      sub_FF88551C\n"
               "LDRSH   R0, [R4,#4]\n"
               "MOV     R2, #0\n"
               "MOV     R1, #0\n"
               "BL      sub_FF8BC36C\n"
               "MOV     R6, R0\n"
               "LDRSH   R0, [R4,#6]\n"
               "BL      sub_FF8BC47C\n"
               "LDRSH   R0, [R4,#8]\n"
               "BL      sub_FF8BC4D4\n"
               "LDRSH   R0, [R4,#0xA]\n"
               "BL      sub_FF8BC52C\n"
               "LDRSH   R0, [R4,#0xC]\n"
               "MOV     R1, #0\n"
               "BL      sub_FF8BC584\n"
               "MOV     R5, R0\n"
               "LDR     R0, [R4]\n"
               "LDR     R8, =0x42258\n"
               "CMP     R0, #0xB\n"
               "MOVEQ   R6, #0\n"
               "MOVEQ   R5, #0\n"
               "BEQ     loc_FF8BD44C\n"
               "CMP     R6, #1\n"
               "BNE     loc_FF8BD44C\n"
               "LDRSH   R0, [R4,#4]\n"
               "LDR     R1, =0xFF8BC2D8\n"
               "MOV     R2, #2\n"
               "BL      sub_FF95B74C\n"
               "STRH    R0, [R4,#4]\n"
               "MOV     R0, #0\n"
               "STR     R0, [R7,#0x28]\n"
               "B       loc_FF8BD454\n"
"loc_FF8BD44C:\n"
               "LDRH    R0, [R8]\n"
               "STRH    R0, [R4,#4]\n"
"loc_FF8BD454:\n"
               "CMP     R5, #1\n"
               "LDRNEH  R0, [R8,#8]\n"
               "BNE     loc_FF8BD470\n"
               "LDRSH   R0, [R4,#0xC]\n"
               "LDR     R1, =0xFF8BC35C\n"
               "MOV     R2, #0x20\n"
               "BL      sub_FF8C0EDC\n"
"loc_FF8BD470:\n"
               "STRH    R0, [R4,#0xC]\n"
               "LDRSH   R0, [R4,#6]\n"
             //"BL      sub_FF8AF4BC\n"   // -
               "BL      sub_FF8AF4BC_my\n" // + ------------------>

               "LDRSH   R0, [R4,#8]\n"
               "MOV     R1, #1\n"
               "BL      sub_FF8AFC0C\n" //__ImgGain.c__0
               "MOV     R1, #0\n"
               "ADD     R0, R4, #8\n"
               "BL      sub_FF8AFC94\n" //__ImgGain.c__0
               "LDRSH   R0, [R4,#0xE]\n"
               "BL      sub_FF8B7778\n" //__BrtCrct.c__560
               "LDR     R4, =0xBB8\n"
               "CMP     R6, #1\n"
               "BNE     loc_FF8BD4C8\n"
               "LDR     R0, [R7,#0x1C]\n"
               "MOV     R2, R4\n"
               "MOV     R1, #2\n"
               "BL      sub_FF885428\n" //__KerFlag.c__0
               "TST     R0, #1\n"
               "LDRNE   R1, =0x5A3\n"
               "LDRNE   R0, =0xFF8BC958\n" // aExpdrv_c
               "BLNE    sub_FF81E88C\n" //DebugAssert
"loc_FF8BD4C8:\n"
               "CMP     R5, #1\n"
               "LDMNEFD SP!, {R4-R8,PC}\n"
               "LDR     R0, [R7,#0x1C]\n"
               "MOV     R2, R4\n"
               "MOV     R1, #0x20\n"
               "BL      sub_FF885428\n" //__KerFlag.c__0
               "TST     R0, #1\n"
               "LDRNE   R1, =0x5A8\n"
               "LDRNE   R0, =0xFF8BC958\n" //aExpdrv_c
               "LDMNEFD SP!, {R4-R8,LR}\n"
               "BNE     sub_FF81E88C\n" //DebugAssert
               "LDMFD   SP!, {R4-R8,PC}\n"
 );
};
void __attribute__((naked,noinline)) sub_FF8AF4BC_my(){ // 
 asm volatile(
                "STMFD   SP!, {R4-R6,LR}\n"
                "LDR     R5, =0x4240\n"
                "MOV     R4, R0\n"
                "LDR     R0, [R5,#4]\n"
                "CMP     R0, #1\n"
                "LDRNE   R1, =0x146\n"
                "LDRNE   R0, =0xFF8AF2C0\n" // aShutter_c
                "BLNE    sub_FF81E88C\n" //DebugAssert
                "CMN     R4, #0xC00\n"
                "LDREQSH R4, [R5,#2]\n"
                "CMN     R4, #0xC00\n"
                "MOVEQ   R1, #0x14C\n"
                "LDREQ   R0, =0xFF8AF2C0\n" //aShutter_c
                "STRH    R4, [R5,#2]\n"
                "BLEQ    sub_FF81E88C\n" //DebugAssert
                "MOV     R0, R4\n"

              //"BL      sub_FFA148C0\n" // -
                "BL      apex2us\n"  // +

                "MOV     R4, R0\n"
                "BL      sub_FF8F8FCC\n"
                "MOV     R0, R4\n"
                "BL      sub_FF8FF24C\n"
                "TST     R0, #1\n"
                "LDRNE   R1, =0x151\n"
                "LDMNEFD SP!, {R4-R6,LR}\n"
                "LDRNE   R0, =0xFF81E88C\n" //aShutter_c
                "BNE     sub_FF81E88C\n" // DebugAssert
                "LDMFD   SP!, {R4-R6,PC}\n"
    );
};
